<template>
  <div style="max-height:80vh;">
    <!-- <pdf
      v-for="i in numPages"
      :key="i"
      :src="pdfUrl"
      :page="i"
      style="display: inline-block; width: 100%"
    >
    </pdf> -->
    <iframe :src="pdfUrl" frameborder="0" style="width:100%; min-height:1220px;" scrolling="no"></iframe>
  </div>
</template>
<script>
import pdf from 'vue-pdf';


export default {
  props: {
    pdfUrl: {
      type: String,
      required: true,
    },
  },
  components: {
    pdf,
  },
  data() {
    return {
      numPages: 1,
    };
  },
  // created() {
  //   console.log(this.pdfUrl);

  //   const headers = {
  //     Authorization: 'Bearer SOME_TOKEN',
  //     'x-ipp-device-uuid': 'SOME_UUID',
  //   };
  //   const loadingTask = pdf.createLoadingTask({
  //     url: this.pdfUrl,
  //     httpHeaders: headers,
  //   });
  //   // eslint-disable-next-line no-shadow
  //   loadingTask.then((pdf) => {
  //     this.pdfUrl = loadingTask;
  //     this.numPages = pdf.numPages;
  //   }).catch((err) => {
  //     console.error(`pdf加载失败${err}`);
  //   });
  // },
};
</script>
